package com.tsx.i18n.controller;

import com.tsx.i18n.dto.UserDTO;
import com.tsx.i18n.utils.LocaleMessage;
import com.tsx.i18n.vo.R;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/test")
@Validated
@RequiredArgsConstructor
public class TestController {
    private final LocaleMessage localeMessage;

    @PostMapping("/user")
    public R<UserDTO> test(@RequestBody @Validated UserDTO userDTO) {
        return R.ok(userDTO);
    }

    @GetMapping("/2")
    public R<String> test2() {
        String message = localeMessage.getMessage("test", new Object[]{"小明"});
        return R.ok(message);
    }
}
